package com.school.campus.service.impl;

import java.util.Collections;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.school.campus.mapper.GoodsMapper;
import com.school.campus.domain.Goods;
import com.school.campus.service.IGoodsService;

/**
 * 货物Service业务层处理
 *
 * @author wwj
 * @date 2025-11-04
 */
@Service
public class GoodsServiceImpl implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    /**
     * 查询货物
     *
     * @param id 货物主键
     * @return 货物
     */
    @Override
    public Goods selectGoodsById(Long id) {
        return goodsMapper.selectGoodsById(id);
    }

    /**
     * 查询货物列表
     *
     * @param goods 货物
     * @return 货物
     */
    @Override
    public List<Goods> selectGoodsList(Goods goods) {
        return goodsMapper.selectGoodsList(goods);
    }

    /**
     * 新增货物
     *
     * @param goods 货物
     * @return 结果
     */
    @Override
    public int insertGoods(Goods goods) {
        return goodsMapper.insertGoods(goods);
    }

    /**
     * 修改货物
     *
     * @param goods 货物
     * @return 结果
     */
    @Override
    public int updateGoods(Goods goods) {
        return goodsMapper.updateGoods(goods);
    }

    /**
     * 批量删除货物
     *
     * @param ids 需要删除的货物主键
     * @return 结果
     */
    @Override
    public int deleteGoodsByIds(Long[] ids) {
        return goodsMapper.deleteGoodsByIds(ids);
    }

    /**
     * 删除货物信息
     *
     * @param id 货物主键
     * @return 结果
     */
    @Override
    public int deleteGoodsById(Long id) {
        return goodsMapper.deleteGoodsById(id);
    }

    @Override
    public List<Goods> selectGoodsByMachineId(Long id) {
        return goodsMapper.selectGoodsByMachineId(id);
    }
}
